package main.java.day09;

/**
 * 使用匿名内部类方式创建两个线程:分别输出1000次，你好和再见
 *
 * @author Xiloer
 */
public class Test03 {
    public static void main(String[] args) {
        Thread t1 = new Thread() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(this.getName() + "你好");
                }
            }
        };
        t1.start();
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(Thread.currentThread().getName() + "再见");
                }
            }
        };
        Thread thread = new Thread(runnable);
        thread.start();
    }

}

